<?php
/**
 * Created by PhpStorm.
 * User: yuyiwen
 * Date: 2018/10/18
 * Time: 下午2:55
 */
class test {
    public function move ()
    {
        echo 123;
    }
}

trait animal {
    public $life = 1;
    public function move ()
    {
        echo 'move...';
    }
}
// trait 特征
trait  fly {
    public $foot = 2;
    public function move ()
    {
        echo 'fly ...';
    }
}
trait swin {
    public $foot = 0;
    public function move ()
    {
        echo 'you...';
    }
}
class bird extends test {
    // traits 的优先级会比继承下来的类要高
    use animal,fly {
        fly::move insteadof animal;
        animal::move as amove;
    }
}

$obj = new bird();
echo $obj->life;
echo $obj->amove();



